package com.miniso.robot.bean;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * @author guojunwang
 * @date 2021-10-18 21:07
 */
@Getter
@NoArgsConstructor
public class NewsMessage extends Message{

    private final String msgtype = "news";

    private Map<String,Object> news = new HashMap(8);
    {
        news.put("articles",new ArrayList());
    }


    public void addArticles(Article article){
        ArrayList articlesList = (ArrayList)this.news.get("articles");
        articlesList.add(article);
    }


    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Article{
        private String title;
        private String description;
        private String url;
        private String picurl;
    }

}

